package pl.edu.agh.pros.proxy.logic.dao;

import pl.edu.agh.pros.proxy.logic.dao.common.AbstractDAO;
import pl.edu.agh.pros.proxy.model.ProviderInfo;

public class ProviderInfoDAO extends AbstractDAO<ProviderInfo> {

	private static final ProviderInfoDAO instance = new ProviderInfoDAO();

	private ProviderInfoDAO() {
		super(ProviderInfo.class);
	}

	public static ProviderInfoDAO getInstance() {
		return instance;
	}

	public ProviderInfo getProviderInfo(String googleMail) {
		ProviderInfo providerInfo = this.getObject("googleMail==param1", "String param1", googleMail);
		if (providerInfo == null) {
			providerInfo = new ProviderInfo();
			providerInfo.setGoogleMail(googleMail);
			providerInfo = this.save(providerInfo);
		}
		return providerInfo;
	}

}